package com.qiandw.myblog.controller;

import com.qiandw.common.result.MessageConstants;
import com.qiandw.common.result.Response;
import com.qiandw.myblog.entity.User;
import com.qiandw.myblog.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 用户控制器
 *
 * @author KG
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;

    @RequestMapping("/getById")
    public Response getById(String id) {
        User user = userService.getById(id);
        List<User> userList = userService.list();
        return new Response(MessageConstants.MSG_SUCCESS, user, null);
    }
}

